package com.cmx.service.impl;

import com.cmx.dao.StudentMapper;
import com.cmx.model.Student;
import com.cmx.model.StudentWithBLOBs;
import com.cmx.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * Created by cmx on 2017/5/12.
 */
@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;
    @Override
    public int insertStudent(StudentWithBLOBs student) {
        studentMapper.insertSelective(student);
        return 0;
    }

    @Override
    public void deleteStudent(Integer id) {
        studentMapper.deleteByPrimaryKey(id);
        return;
    }

    @Override
    public void updateStudent(StudentWithBLOBs student) {

        studentMapper.updateByPrimaryKeySelective(student);
        return;
    }

    @Override
    public Student selectStudent(Integer id) {
        Student student = studentMapper.selectByPrimaryKey(id);
        return student;
    }
}
